package acm.na2004.eastcentral;

import java.util.Scanner;


public class p1541 {

	public static void main(String[] args) {

		Scanner scanner = new Scanner(System.in);
		String s;
		while (true) {
			s = scanner.next();
			if (s.startsWith("0")) {
				break;
			}
			else {
				long count = solve(s);
				System.out.println(count);
			}
		}
	}

	private static long solve(String s) {
		int len = s.length();
		long[] count = new long[len+2];
		
		count[len] = count[len+1] = 1;

		for (int i=len-1;i>=0;--i) {
			for (int j=1;j<=2;++j) {
				int n = getNum(s,i,j,len);
				if (n != -1) {
					count[i] += count[i+j];
				}
			}
		}

		return count[0];
	}

	private static int getNum(String s, int idx, int len, int n) {
		if (idx + len > n) {
			return -1;
		}
		if (s.charAt(idx) == '0') {
			return  -1;
		}
		int result = 0;
		for (int i=idx;i<idx+len;++i) {
			result *= 10;
			result += (s.charAt(i) - '0');
		}
		if (result >= 1 && result <= 26) {
			return result;
		}
		else {
			return -1;
		}
	}

}
